<ix-modal-header
  [requiredRoles]="requiredRoles"
  [title]="'Edit Disk' | translate"
  [loading]="isLoading()"
></ix-modal-header>

<mat-card>
  <mat-card-content>
    <form class="ix-form-container" [formGroup]="form" (submit)="onSubmit()">
      <ix-fieldset [title]="helptext.generalTitle | translate">
        <ix-input
          formControlName="name"
          [label]="'Name' | translate"
          [readonly]="true"
        ></ix-input>

        <ix-input
          formControlName="serial"
          [label]="'Serial' | translate"
          [readonly]="true"
        ></ix-input>

        <ix-input
          formControlName="description"
          [label]="'Description' | translate"
        ></ix-input>
      </ix-fieldset>

      <mat-divider></mat-divider>

      <ix-fieldset [title]="helptext.powerManagementTitle | translate">
        <ix-select
          formControlName="hddstandby"
          [required]="true"
          [label]="'HDD Standby' | translate"
          [tooltip]="helptext.standbyTooltip | translate"
          [options]="hddstandbyOptions$ | translateOptions"
        ></ix-select>

        <ix-select
          formControlName="advpowermgmt"
          [required]="true"
          [label]="'Advanced Power Management' | translate"
          [options]="advpowermgmtOptions$ | translateOptions"
        ></ix-select>
      </ix-fieldset>

      <mat-divider></mat-divider>

      <div class="two-columns">
        @if (showSedSection()) {
          <ix-fieldset [title]="helptext.sedTitle | translate">
            <ix-input
              formControlName="passwd"
              type="password"
              [label]="'SED Password' | translate"
              [tooltip]="helptext.passwordTooltip | translate"
            ></ix-input>

            <ix-checkbox
              formControlName="clear_pw"
              [label]="'Clear SED Password' | translate"
            ></ix-checkbox>
          </ix-fieldset>
        }
      </div>

      <mat-card-actions class="buttons">
        <button
          *ixRequiresRoles="requiredRoles"
          mat-button
          type="submit"
          color="primary"
          ixTest="save"
          [disabled]="form.invalid || isLoading()"
        >
          {{ 'Save' | translate }}
        </button>
      </mat-card-actions>
    </form>
  </mat-card-content>
</mat-card>
